<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>凡客-会员中心-我的订单</title>
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/org/bootstrap-3.3.5-dist/css/bootstrap.min.css" />
		<script src="{{__PUBLIC__}}/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="{{__PUBLIC__}}/Home/org/bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/dingdan.css" />

		<!-- 弹窗插件 -->
		<script src="{{__PUBLIC__}}/Home/js/qikoo.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/qikoo.css" />
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/store.css" />
	</head>

	<body>
		{{include file="VIEW_PATH/Common/header.php"}}
		<!--主体部分-->

		<div id="position">
			您当前的位置：<a href="{{U('Index/index')}}">凡客首页</a> > <a href="{{U('index')}}">我的凡客</a> > <a href="javascript:;">我的订单</a>
		</div>
		<div id="welcome">
			<div id="side-nav">
				<h2><a href="{{U('index')}}">我的凡客</a></h2>
				<ul>
					<li>
						<h3>订单中心</h3>
					</li>
					<li class="index">
						<a href="javascript:;">·我的订单</a>
					</li>
					
				</ul>
				<ul>
					<li>
						<h3>客户服务</h3>
					</li>
					<li>
						<a href="{{U('tui')}}">·退换货办理</a>
					</li>
					
				</ul>
				<ul>
					<li>
						<h3>账户管理</h3>
					</li>
					<li>
						<a href="{{U('record')}}">·账户记录</a>
					</li>
					<li>
						<a href="{{U('address')}}">·收货地址</a>
					</li>
					<li>
						<a href="{{U('safe')}}">·修改密码</a>
					</li>
					<li>
						<a href="{{U('ziliao')}}">·我的资料</a>
					</li>
					
				</ul>
			</div>
			<h6> <span>我的订单</span> <a href="">谨防诈骗公告</a></h6>
			<div id="security">
				<em>账户安全：</em>
				<div class="level">
					<span class="index">弱</span><span>中</span><span>强</span>
				</div>
				<ul>
					<li>
						<a href="" class="tu tu1"></a>
						<a href="">手机未验证</a>
					</li>
					<li>
						<a href="" class="tu tu2"></a>
						<a href="">邮箱未验证</a>
					</li>
					<li>
						<a href="" class="tu tu3"></a>
						<a href="">未设置支付密码</a>
					</li>
				</ul>
				<p>
					为了您账户资金安全，建议进行 <a href="">设置</a>
				</p>
			</div>
			<script type="text/javascript">
				$(function(){
					// tab切换
					var x = 0;
					x = {{$_GET['dg']}};
					$('#wtitle a').eq(x).addClass('index').siblings('a').removeClass('index');

					// 订单管理
					$.each($('.status'), function(k, v) {
						if($(this).text()=='未付款'){
							$(this).parents('tr').find('.dggl').html('<a href="javascript:;" class="dg_fk">去付款</a><a href="javascript:;" class="dg_out out">取消订单</a>')
						}
						if($(this).text()=='待发货'){
							$(this).parents('tr').find('.dggl').html('<a href="javascript:;" class="dg_out out">取消订单</a>')
						}
						if($(this).text()=='已发货'){
							$(this).parents('tr').find('.dggl').html('<a href="javascript:;" class="dg_out con">确认收货</a>')
						}
						if($(this).text()=='已完成'){
							$(this).parents('tr').find('.dggl').html('<a href="javascript:;" class="dg_out del">删除订单</a>')
						}
					});
				})
			</script>
			<!-- // 确认收货 -->
			<script type="text/javascript">
				$(function(){
					$('.dg_out.con').live('click', function() {
						var _this = $(this);
						$('.dialog-delorder').remove();
						// 显示弹框
						if($(this).next('div.dialog-delorder').length <= 0)
							$(this).after('<div class="dialog-delorder"><div class="dialog-bar">温馨提示<a href="javascript:;"  class="dialog-close" title="关闭"></a></div><div class="dialog-content"><p>确认 收货 吗？</p></div><div class="dialog-console"><a class="console-btn-confirm yes" href="javascript:;" title="确定">确定</a><a class="console-btn-cancel cancel" href="javascript:;" title="取消">取消</a></div></div>');
						$('.dialog-delorder').animate({opacity: 1}, 300);
						$('.yes').live('click', function(){
							var oid = _this.parents('table').find('tr input[name=oid]').val();
							// 发送ajax
							$.ajax({
								url: '{{U('orderConfirm')}}',
								type: 'POST',
								dataType: 'json',
								data: {oid:oid},
								success:function(data){
									_this.parents('table').remove();
								}
							})
						});
						// 取消隐藏弹窗
						$('.cancel,.dialog-close').live('click', function(){
							$(this).parents('div.dialog-delorder').fadeOut(300, function() {
								$(this).parents('div.dialog-delorder').remove();
							});
						});
						
					});
				})
			</script>

			<!-- // 取消订单 -->
			<script type="text/javascript">
				$(function(){
					$('.dg_out.out').live('click', function() {
						var _this = $(this);
						$('.dialog-delorder').remove();
						// 显示弹框
						if($(this).next('div.dialog-delorder').length <= 0)
							$(this).after('<div class="dialog-delorder"><div class="dialog-bar">温馨提示<a href="javascript:;"  class="dialog-close" title="关闭"></a></div><div class="dialog-content"><p>确定 取消 该订单吗？</p></div><div class="dialog-console"><a class="console-btn-confirm yes" href="javascript:;" title="确定">确定</a><a class="console-btn-cancel cancel" href="javascript:;" title="取消">取消</a></div></div>');
						$('.dialog-delorder').animate({opacity: 1}, 300);
						$('.yes').live('click', function(){
							var oid = _this.parents('table').find('tr input[name=oid]').val();
							// 发送ajax
							$.ajax({
								url: '{{U('orderOut')}}',
								type: 'POST',
								dataType: 'json',
								data: {oid:oid},
								success:function(data){
									_this.parents('table').remove();
								}
							})
						});
						// 取消隐藏弹窗
						$('.cancel,.dialog-close').live('click', function(){
							$(this).parents('div.dialog-delorder').fadeOut(300, function() {
								$(this).parents('div.dialog-delorder').remove();
							});
						});
						
					});
				})
			</script>
			<!-- // 删除订单 -->
			<script type="text/javascript">
				$(function(){
					$('.dg_out.del').live('click', function() {
						var _this = $(this);
						$('.dialog-delorder').remove();
						// 显示弹框
						if($(this).next('div.dialog-delorder').length <= 0)
							$(this).after('<div class="dialog-delorder"><div class="dialog-bar">温馨提示<a href="javascript:;"  class="dialog-close" title="关闭"></a></div><div class="dialog-content"><p>确定 删除 订单吗？</p></div><div class="dialog-console"><a class="console-btn-confirm yes" href="javascript:;" title="确定">确定</a><a class="console-btn-cancel cancel" href="javascript:;" title="取消">取消</a></div></div>');
						$('.dialog-delorder').animate({opacity: 1}, 300);
						$('.yes').live('click', function(){
							var oid = _this.parents('table').find('tr input[name=oid]').val();
							// 发送ajax
							$.ajax({
								url: '{{U('orderDel')}}',
								type: 'POST',
								dataType: 'json',
								data: {oid:oid},
								success:function(data){
									_this.parents('table').remove();
								}
							})
						});
						
						// 取消隐藏弹窗
						$('.cancel,.dialog-close').live('click', function(){
							$(this).parents('div.dialog-delorder').fadeOut(300, function() {
								$(this).parents('div.dialog-delorder').remove();
							});
						});
						
					});
				})
			</script>
			<!-- 去付款 -->
			<script type="text/javascript">
				$(function(){
					$('.dg_fk').live('click', function() {
						var onumber = $(this).parents('table').find('.wuXian span').text();
						// alert(onumber);
						// 异步发送到php
						$.ajax({
							url: '{{U('ajaxFk')}}',
							type: 'POST',
							dataType: 'json',
							data: {onumber:onumber},
							success:function(){
								window.location.href='{{U('Success/index')}}';
							}
						})
					});
				})
			</script>

			<!-- 去购买 -->
			<script type="text/javascript">
				$(function(){
					$('.gouMai').live('click', function() {
						var _this=$(this).parents('table');
						// 组数组
						var arr = new Array();
						$.each(_this.find('.goods_go'), function(k, v) {
							arr[k] = {
								'id': $(this).find('input[name=gid]').val(),
								'num':$(this).find('strong i').text(),
								'options':$(this).find('input[name=options]').val(),
							}
						});
						// console.log(arr);
						// 发送ajax
						$.ajax({
							url: '{{U('ajaxGm')}}',
							type: 'POST',
							dataType: 'json',
							data: {arr: arr},
							success:function(){
								window.location.href='{{U('Car/index')}}';
							}
						})
					});
				})
			</script>
			<div id="wtitle">
				{{foreach from="$orderNum" key="$k" value="$v"}}
				<a href="{{U('dingdan',array('dg'=>$k))}}">
					{{foreach from="$v" key="$kk" value="$vv"}}
					{{$kk}}（{{$vv}}）
					{{endforeach}}
				</a>
				{{endforeach}}
				<select name="">
					<option value="">30天内的订单</option>
					<option value="">2016年的订单</option>
					<option value="">2015年的订单</option>
					<option value="">更早的订单</option>
				</select>
			</div>
			<div id="windent">
				<div class="windent">
				{{if value="empty($orderData)"}}
					<div class="kong"><center>目前您暂无此类型的订单，请点击其他标签进行查看。</center></div>
				{{else}}
					{{foreach from="$orderData" key="$k" value="$v"}}
					<table class="nr_tab">
						<tr>
							<input type="hidden" name="oid" value="{{$v['oid']}}" />	
						</tr>
						<tr>
							<th colspan="5">
								订单总金额	
								<span class="jinE">￥{{$v['total']}}</span>
								<span class="wuXian">订单号：<span>{{$v['onumber']}}</span></span>
								<span class="shiJian">{{date('Y-m-d H:i:s',$v['time'])}}</span>
							</th>
						</tr>
						<tr>
							<td width="320">
								{{foreach from="$v['list']" key="$kk" value="$vv"}}
									<div class="goods_go">
										<input type="hidden" name="gid" value="{{$vv['goods_gid']}}" />
										<input type="hidden" name="options" value="{{$vv['ocombine']}}" />
										<a class="tuPian" href="{{U('Desc/index',array('gid'=>$vv['goods']['gid']))}}" target="_blank"><img src="{{$vv['goods']['pic']}}" alt="" /></a>
										<a class="bianHao" href="{{U('Desc/index',array('gid'=>$vv['goods']['gid']))}}" target="_blank" title="{{$vv['goods']['gname']}} {{$vv['combine']}}">{{$vv['goods']['gname']}} {{$vv['combine']}}</a>
										<strong><i>{{$vv['quantity']}}</i>{{$vv['goods']['unit']}}</strong>
									</div>
								{{endforeach}}
							</td>
							<td width="160" style="position: relative;">
								<p class="jinE">￥{{$v['total']}}</p>
								<p class="yinHang">工商银行</p>
								<div class="hideshow">
									<span>{{$_SESSION['hname']}}</span>
									<div class="hidebox">
										<div class="jiantou"></div>
										<div class="content">
											{{$v['address']['consignee']}}<br />
											{{$v['address']['district']}} {{$v['address']['detail']}}<br />
											{{$v['address']['tel']}}
										</div>
									</div>
								</div>
							</td>
							<td width="100" class="dgzt"><a href="javascript:;" class="status">{{$v['status']}}</a></td>
							<td width="135" class="dggl">
								<a class="gouMai" href="javascript:;">购买</a>
								<a href="javascript:;" class="dg_out del">删除订单</a>
							</td>
						</tr>
					</table>
					{{endforeach}}
					<div class="white" style="height:50px;float:right;"></div>
				{{endif}}
				</div>
			</div>
			
		</div>
		{{include file="VIEW_PATH/Common/footer.php"}}

	</body>

</html>